<template>
  <div>
    <subject-tree-item v-for="childNode in treeData" :childNode="childNode" @make-folder="makeFolder"></subject-tree-item>
  </div>
</template>
<script>
import SubjectTreeItem from "./subject-tree-item";
import { useRouter } from "vue-router"
import { ref, defineComponent } from "vue";
export default defineComponent({
  components: {
    SubjectTreeItem
  },
  props: {
    treeData: {
      type: Array,
      required: true,
      default(){
        return []
      }
    }
  },
  setup(props) {
    const nodeData = ref(props.treeData);
    const router = useRouter();
    const makeFolder= (item)=>{
      router.push({ name: 'question', params: { id: item.id, examType: "CHAPTER" } })
    }
    return {
      nodeData,
      makeFolder
    }
  }
})

</script>
<style scoped>

</style>

